package org.millioncall.yueyoga.admin.dao.impl;

import org.millioncall.openplatform.common.PaginateParams;
import org.millioncall.openplatform.common.PaginatedList;
import org.millioncall.openplatform.common.StartLimitPairImpl;
import org.millioncall.openplatform.dao.PreparedQuery;
import org.millioncall.yueyoga.admin.dao.BaseDao;
import org.millioncall.yueyoga.admin.dao.GoodsOrderDetailDAO;
import org.millioncall.yueyoga.admin.model.GoodsOrderDetail;

public class GoodsOrderDetailDAOImpl extends BaseDao implements GoodsOrderDetailDAO {

	@Override
	public PaginatedList<GoodsOrderDetail> getGoodsOrderDetailInPage(
			Integer id, int start, int limit) {
		try {
			PreparedQuery<GoodsOrderDetail> pq = this.getPagableSqlSessionTemplate()
					.findAll("findInPageByMemberId",id);
			PaginatedList<GoodsOrderDetail> pl = pq.list(new PaginateParams(
					new StartLimitPairImpl(start, limit)));
			return pl;
		} catch (RuntimeException re) {
			throw re;
		}
	}

	@Override
	public int save(GoodsOrderDetail goodsOrderDetail) {
		return this.getPagableSqlSessionTemplate().insert("insertGoodsOrderDetail",goodsOrderDetail);
	}

}
